﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="_课堂练习1.aspx.cs" Inherits="WebApplication1.课堂练习1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <h2>实现护照的输入验证</h2>
            <p>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="RequiredFieldValidator" ForeColor="Red">输入不能为空！</asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1" Display="Dynamic" ErrorMessage="RegularExpressionValidator" ForeColor="Fuchsia" ValidationExpression="(P\d{7})|(G\d{8})">输入格式错误！</asp:RegularExpressionValidator>
                <asp:Button ID="Button1" runat="server" Text="验证" />
            </p>
            <p>&nbsp;</p>

        </div>
    </form>
</body>
</html>
